package com.cate.mapper;

import com.cate.annotation.AutoFill;
import com.cate.pojo.entity.Employee;
import com.cate.enums.OperationType;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;


/**
 * @CreateTime: 2023/7/26
 * @Author: <==lhd==>
 * @Description: 员工信息管理
 */

@Mapper
public interface EmployeeMapper {
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    @Update("update employee set password=#{password} where id=#{empId}")
    boolean editPassword(Long empId, String password);

    @Update("update employee set status = #{status} where id=#{empId}")
    boolean setStatus(Long empId, int status);

    Page<Employee> selectList(@Param("name") String name);

    @AutoFill(value = OperationType.INSERT)
    boolean insertOne(Employee employee);

    @Select("select * from employee where id = #{id}")
    Employee getById(Long id);

    @AutoFill(OperationType.UPDATE)
    boolean update(Employee employee);

}
